#include "stdafx.h"

#include "physics.h"
#include <process.h>

CPhysicEngine * CPhysicEngine::_inst = 0;

CPhysicEngine::CPhysicEngine() : _is_running(1)
{
	_physics_thread_handle = (HANDLE) _beginthreadex(NULL, 0, &CPhysicEngine::_thread_entrypoint, this, CREATE_SUSPENDED, NULL);
}

void CPhysicEngine::_init()
{

}

unsigned int __stdcall CPhysicEngine::_thread_entrypoint(void *args)
{
	CPhysicEngine * physics_engine = (CPhysicEngine *)args;
	physics_engine->_init();
	
	while (physics_engine->_is_running)
	{
		// update world params
		// update entities
		;
		// copy data to renderer
	}

	_endthreadex(42);
	return 0;
}